import { ref } from 'vue'
import { defineStore } from 'pinia'
export const useAgentStore = defineStore('agentStore', () => {
  const agentInfo = ref({
		apply: {
			id: '', //代理商编码
			site_code: "", //负责城市
			mobile: "",
			id_img_1: "", //身份证正面
			id_img_2: "", //身份证反面
			id_img_3: "" //手持身份证
		}, //申请资料信息
		avatar: "", //代理头像
		id: '', //用户ID
		name: "", //代理昵称
		company_deposit: "", //总收益
		company_deposit_day: "", //今日分红
		son_shop: '', //下属商户
		son_rider: '' //下属外卖员
	})
	const SETAGENTINFO = (info) => {
		agentInfo.value = info
	}
	return {
		agentInfo,
		SETAGENTINFO
	}
}, {
  // 数据持久化
	persist: {
		storage: {
			getItem: (key) => {
			  return uni.getStorageSync(key)
			},
			setItem: (key, value) => {
			  return uni.setStorageSync(key, value)
			},
		}
	}
})
